package Jihe;

import java.util.Arrays;
import java.util.Collection;

public class ArrayList<E> {
	private Object[] elementData;

	/* Java代码 收藏代码 */
	public ArrayList() {
		this(10);
	}

	public ArrayList(int initialCapacity) {
		super();
		if (initialCapacity < 0)
			throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
		this.elementData = new Object[initialCapacity];
	}

	public ArrayList(Collection<? extends E> c) {
		elementData = c.toArray();
		int size = elementData.length;
		// c.toArray might (incorrectly) not return Object[] (see 6260652)
		if (elementData.getClass() != Object[].class)
			elementData = Arrays.copyOf(elementData, size, Object[].class);
	}
}
